﻿using System.Diagnostics.Contracts;
#if NETFX_CORE
using Windows.Storage;
#else
using System.IO;
#endif

namespace DaveSexton.Labs
{
	internal static class FileSystem
	{
#if NETFX_CORE
		public static IFile GetFile(IStorageFile file)
		{
			Contract.Requires(file != null);
			Contract.Ensures(Contract.Result<IFile>() != null);

			return new FileObject(file);
		}
#elif !SILVERLIGHT
		public static IFile GetFile(string fileName)
		{
			Contract.Requires(fileName != null);
			Contract.Ensures(Contract.Result<IFile>() != null);

			return new FileObject(fileName);
		}
#else
		public static IFile GetFile(FileInfo file)
		{
			Contract.Requires(file != null);
			Contract.Ensures(Contract.Result<IFile>() != null);

			return new FileObject(file);
		}
#endif

#if NETFX_CORE
		public static IFolder GetFolder(IStorageFolder folder)
		{
			Contract.Requires(folder != null);
			Contract.Ensures(Contract.Result<IFolder>() != null);

			return new FolderObject(folder);
		}
#else
		public static IFolder GetFolder(string path)
		{
			Contract.Requires(path != null);
			Contract.Ensures(Contract.Result<IFolder>() != null);

			return new FolderObject(path);
		}
#endif
	}
}